package com.hrzyit.whistle.cases.presenter

import com.hrzyit.base.ext.execute
import com.hrzyit.base.presenter.BasePresenter
import com.hrzyit.base.rx.BaseObserver
import com.hrzyit.whistle.cases.data.bean.CaseIndexUserInfoVo
import com.hrzyit.whistle.cases.presenter.view.WhistleSelectUserView
import com.hrzyit.whistle.cases.service.ICaseCenterService
import javax.inject.Inject

/**
 * 案件管理-吹哨人员选择 Presenter
 * @author YangWei
 * @date 2019/4/20
 */
class WhistleSelectUserPresenter @Inject constructor():BasePresenter<WhistleSelectUserView>() {

    @Inject
    lateinit var caseCenterService: ICaseCenterService

    /**
     * 获取批转单位的人员信息列表
     * @author YangWei
     * @date 2019/4/19
     * @param caseId   案件id
     * @param userId   操作人id
     * @param deptId   批转到单位id
     * @return 批转单位的人员信息列表 @{link CaseIndexUserInfoVo}
     */
    fun selectCaseWhistleUserList(caseId: Long, userId: Long, deptId:Long) {
        if (!checkNetWork()) {
            return
        }

        // 显示进度框
        mView.showLoading()

        caseCenterService.selectCaseTransferUserList(caseId, userId,deptId)
            .execute(object : BaseObserver<MutableList<CaseIndexUserInfoVo>>(mView) {
                override fun onNext(t: MutableList<CaseIndexUserInfoVo>) {
                    mView.onGetSelectCaseWhistleUserListSuccess(t)
                }
            }, lifecycleProvider)
    }

}